package com.example.designpatterns.abstractfactory;

/**
 * 抽象工厂模式演示类
 */
public class AbstractFactoryDemo {
    public static void main(String[] args) {
        // 使用具体工厂1
        System.out.println("===== 使用具体工厂1 =====");
        AbstractFactory factory1 = new ConcreteFactory1();
        ProductA productA1 = factory1.createProductA();
        ProductB productB1 = factory1.createProductB();
        
        productA1.operationA();
        productB1.operationB();
        
        // 使用具体工厂2
        System.out.println("\n===== 使用具体工厂2 =====");
        AbstractFactory factory2 = new ConcreteFactory2();
        ProductA productA2 = factory2.createProductA();
        ProductB productB2 = factory2.createProductB();
        
        productA2.operationA();
        productB2.operationB();
    }
} 